package br.urca.impl;

import java.util.List;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;

import br.urca.dao.SituacaoDAO;
import br.urca.model.Situacao;

@Transactional
public class JPASituacaoDAO implements SituacaoDAO {
	
	private EntityManager manager;
	
	public JPASituacaoDAO() {
		this(null);
	}
	
	@Inject
	public JPASituacaoDAO(EntityManager manager) {
		this.manager = manager;
	}

	@Override
	public List<Situacao> todos() {
		return this.manager.createQuery("SELECT s FROM Situacao s", Situacao.class)
				.getResultList();
	}

}
